<!DOCTYPE html>
<html>
<head lang="zh-cn">
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="renderer" content="webkit">
	<title>注册俱乐部 - WEFA联盟</title>
	<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css">
	<!--[if lt IE 9]>
	<script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
	<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
	<div class="container">
		<div class="navbar-header">
			<a class="navbar-brand" href="#">WEFA联盟</a>
		</div>
		<div id="navbar" class="navbar-collapse collapse">
			<ul class="nav navbar-nav">
				<li class="active"><a href="__APP__\Home\Index\index">主页</a></li>
				<li><a href="__APP__\League\Index\index">联赛</a></li>
				<li><a href="__APP__\League\Cup\index">杯赛</a></li>
			</ul>
			<div class="nav navbar-nav navbar-right">
				<a type="button" class="btn btn-default navbar-btn" href="__APP__\Team\Index\signUp">注册俱乐部</a>
				<a type="button" class="btn btn-default navbar-btn" href="__APP__\Team\Index\login">登录</a>
			</div>
		</div><!--/.nav-collapse -->
	</div>
</nav>
<div class="container">
	<form role="form" autocomplete="off">
		<div class="form-group">
			<label class="control-label" for="tname">俱乐部名称</label>
			<input type="text" class="form-control" id="tname" placeholder="请输入俱乐部名称" autocomplete="off">
			<span class="help-block">输入游戏中的俱乐部名称。</span>
		</div>
		<div class="form-group">
			<label class="control-label" for="password">请输入密码</label>
			<input type="password" class="form-control" id="password" placeholder="请输入密码" autocomplete="off">
			<span class="help-block">登录密码，请避免与游戏帐号密码重复，以免游戏帐号发生丢失</span>
		</div>
	</form>
	<button id="reg-btn" class="btn btn-default">注册俱乐部</button>
</div>

<script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script>
	$(function () {
		$('#reg-btn').on('click', function () {
			if(!$('#tname').val()) {
				$('#tname').parent('.form-group').addClass('has-error');
				$('#tname').next('.help-block').html('请输入俱乐部名称');
			} else if(!$('#password').val()) {
				$('#password').parent('.form-group').addClass('has-error');
				$('#password').next('.help-block').html('请输入密码');
			} else {
				$.get('{:U('/Team/Index/reg')}', {
					"tname": $('#tname').val(),
					"password": $('#password').val()
				}, function (data) {
					if(data.status == '0') {
						alert('成功注册');
						window.location = "{:U('/Home/Index/index')}";
					} else {
						$('#tname').parent('.form-group').addClass('has-error');
						$('#tname').next('.help-block').html(data.data.info);
					}
				});
			}
		});
	});
</script>
</body>
</html>